function nvl(c, b) {
    var a = b != null ? b: "-";
    return c != null ? c: a
}
function convertDate(a) {
    return nvl(a).replace("T", " ")
}
function onlyInputNumEx(b, a) {
    b.bind("keydown", 
    function(c) {
        onlyInputNum(c, a)
    });
    b.bind("keyup change blur", 
    function() {
        if (a) {
            var c = b.val();
            if (c != "" && isNaN(c)) {
                b.val(c.replace(/[\D\.]+/, ""))
            }
        } else {
            var c = b.val();
            if (c != "" && (/\D/).test(c)) {
                b.val(c.replace(/\D+/, ""))
            }
        }
    })
}
function onlyInputNum(b, a) {
    if (b.keyCode == 46 || b.keyCode == 8 || b.keyCode == 9 || b.keyCode == 27 || b.keyCode == 13 || (b.keyCode == 65 && b.ctrlKey === true) || (b.keyCode == 67 && b.ctrlKey === true) || (b.keyCode == 86 && b.ctrlKey === true) || (b.keyCode >= 35 && b.keyCode <= 40) || (a && (b.keyCode == 190 || b.keyCode == 110))) {
        return
    } else {
        if (b.shiftKey || ((b.keyCode < 48 || b.keyCode > 57) && (b.keyCode < 96 || b.keyCode > 105))) {
            b.preventDefault()
        }
    }
}
function onlyInputNumChar(a) {
    if (a.keyCode == 46 || a.keyCode == 8 || a.keyCode == 9 || a.keyCode == 27 || a.keyCode == 13 || (a.keyCode == 65 && a.ctrlKey === true) || (a.keyCode == 67 && a.ctrlKey === true) || (a.keyCode == 86 && a.ctrlKey === true) || (a.keyCode >= 35 && a.keyCode <= 40)) {
        return
    } else {
        if (a.shiftKey || !(a.keyCode >= 48 && a.keyCode <= 57 || a.keyCode >= 65 && a.keyCode <= 90 || a.keyCode >= 97 && a.keyCode <= 122)) {
            a.preventDefault()
        }
    }
}
function isEmail(a) {
    return (/^([\w-\.]+@([\w-]+\.)+[\w-]{2,4})?$/).test(a)
}
function isNum(d, b, c, a, f) {
    try {
        var h = b == true ? !isNaN(d) : !(/\D/).test(d);
        if (h) {
            if (arguments.length == 4) {
                if (c) {
                    h = d.length >= a
                } else {
                    h = (a == Math.max(d, a))
                }
            } else {
                if (arguments.length > 4) {
                    if (c) {
                        h = (d.length >= f && d.length <= a)
                    } else {
                        h = (a == Math.max(d, a) && d == Math.max(d, f))
                    }
                }
            }
        }
        return h
    } catch(g) {
        return false
    }
}
function isTime(k, a, j, b) {
    try {
        a = a == undefined ? 0: a;
        j = j == undefined ? 1: j;
        b = b == undefined ? 2: b;
        k = k.replace(/-/g, ":").replace(/\./g, ":");
        var d = k.split(":");
        var c = true;
        if (! (d[a].length == 1 || d[a].length == 2)) {
            c = false
        }
        if (c && !(d[j].length == 1 || d[j].length == 2)) {
            c = false
        }
        if (c && !(d[b].length == 1 || d[b].length == 2)) {
            c = false
        }
        if (c) {
            var i = parseInt(d[a], 10);
            var g = parseInt(d[j], 10);
            var f = parseInt(d[b], 10);
            if (c = ((i <= 23 && i >= 0) || (i == 24 && g == 0 && f == 0))) {
                if (c = (g <= 60 && g >= 0)) {
                    c = (f <= 60 && f >= 0)
                }
            }
        }
        return c
    } catch(h) {
        return false
    }
}
function isDate(l, m, d, c, k) {
    try {
        d = d == undefined ? 0: d;
        c = c == undefined ? 1: c;
        k = k == undefined ? 2: k;
        l = l.replace(/-/g, "/").replace(/\./g, "/");
        var g = l.split("/");
        var f = true;
        if (! (g[k].length == 1 || g[k].length == 2)) {
            f = false
        }
        if (f && !(g[c].length == 1 || g[c].length == 2)) {
            f = false
        }
        if (f && g[d].length != 4) {
            f = false
        }
        if (f) {
            var j = parseInt(g[k], 10);
            var h = parseInt(g[c], 10);
            var a = parseInt(g[d], 10);
            if (f = (!m || (a > 1900) && (a <= new Date().getFullYear()))) {
                if (f = (h <= 12 && h > 0)) {
                    var b = (((a % 4) == 0) && ((a % 100) != 0) || ((a % 400) == 0));
                    if (h == 2) {
                        f = b ? j <= 29: j <= 28
                    } else {
                        if ((h == 4) || (h == 6) || (h == 9) || (h == 11)) {
                            f = (j > 0 && j <= 30)
                        } else {
                            f = (j > 0 && j <= 31)
                        }
                    }
                }
            }
        }
        return f
    } catch(i) {
        return false
    }
}
var REPLACE_LIST = new Array("<br>", "<br/>", "<br />");
var REPLACE_STR = "####n####";
var PATTERN_LIST = new Array();
PATTERN_LIST.push(/<span style="[^<>]+">[^<>]+<\/span>/g);
PATTERN_LIST.push(/<strong>[^<>]+<\/strong>/g);
PATTERN_LIST.push(/<b>[^<>]+<\/b>/g);
PATTERN_LIST.push(/<font color="[#a-zA-F0-9]*">[^<>]+<\/font>/g);
PATTERN_LIST.push(/<p style="[^<>]+">[^<>]+<\/p>/g);
PATTERN_LIST.push(/<p>[^<>]+<\/p>/g);
function replaceQuestion(f) {
    if (!isNotEmpty(f)) {
        return ""
    }
    var c = f;
    var e = new Array();
    for (var b = 0; b < REPLACE_LIST.length; b++) {
        var d = new RegExp(REPLACE_LIST[b], "g");
        c = c.replace(d, REPLACE_STR.replace("n", e.length));
        e.push(REPLACE_LIST[b])
    }
    var a = null;
    while ((a = checkPATTERNLIST(c)) != null) {
        c = c.replace(a, REPLACE_STR.replace("n", e.length));
        e.push(a)
    }
    c = c.replace(/<[^<]+?>/g, "");
    c = replaceALLHTML(c);
    for (var b = e.length - 1; b >= REPLACE_LIST.length; b--) {
        c = c.replace(REPLACE_STR.replace("n", b), e[b])
    }
    for (var b = 0; b < REPLACE_LIST.length; b++) {
        var d = new RegExp(REPLACE_STR.replace("n", b), "g");
        c = c.replace(d, REPLACE_LIST[b])
    }
    return c
}
function checkPATTERNLIST(c) {
    var a = null;
    for (var b = 0; b < PATTERN_LIST.length; b++) {
        a = PATTERN_LIST[b].exec(c);
        if (a != null) {
            PATTERN_LIST[b].lastIndex = 0;
            break
        }
    }
    return a
}
function replaceNormalHTML(e) {
    if (!isNotEmpty(e)) {
        return ""
    }
    var b = e;
    var d = new Array();
    for (var a = 0; a < REPLACE_LIST.length; a++) {
        var c = new RegExp(REPLACE_LIST[a], "g");
        b = b.replace(c, REPLACE_STR.replace("n", d.length));
        d.push(REPLACE_LIST[a])
    }
    b = replaceALLHTML(b);
    for (var a = 0; a < REPLACE_LIST.length; a++) {
        var c = new RegExp(REPLACE_STR.replace("n", a), "g");
        b = b.replace(c, REPLACE_LIST[a])
    }
    return b
}
function replaceALLHTML(b) {
    if (!isNotEmpty(b)) {
        return ""
    }
    var a = b;
    a = a.replace(/\'/g, "&apos;");
    a = a.replace(/\"/g, "&quot;");
    a = a.replace(/</g, "&lt;");
    a = a.replace(/>/g, "&gt;");
    return a
}
function removeALLHTML(b) {
    if (!isNotEmpty(b)) {
        return ""
    }
    var a = b;
    a = a.replace(/<[^<]+?>/g, "");
    a = replaceALLHTML(a);
    return a
}
function replaceEnter(a) {
    if (!isNotEmpty(a)) {
        return ""
    } else {
        return a.replace(/(\r)*\n/g, "")
    }
}
function checkEnter(b) {
    if (!isNotEmpty(b)) {
        return false
    }
    var a = /(\r)*\n/;
    return a.exec(b)
}
function replaceBlankToHtml(b) {
    var a = replaceALLHTML(b);
    if (!isNotEmpty(a)) {
        return ""
    }
    return a.replace(/(\r)*\n/g, "<br>")
}
function replaceBlankFromHtml(a) {
    if (!isNotEmpty(a)) {
        return ""
    }
    return a.replace(/<br>/g, "\r\n")
}
function getImageUrl(a) {
    if (a != null && a != "") {
        if (a.indexOf("http") != 0) {
            return ctx + "/" + a
        } else {
            return a
        }
    } else {
        return ""
    }
}
function checkeURL(a) {
    var d = a;
    var c = /([\w-]+\.)+[\w-]+(\/[\w- .\/?%&=]*)?/;
    var b = new RegExp(c);
    if (b.test(d) == true) {
        return true
    } else {
        return false
    }
};